#include<iostream>
#include<vector>
using namespace std;

void swap(int& a, int& b)
{
	a ^= b;
	b ^= a;
	a ^= b;
}

void sortArray(vector<int>& ans)
{
	int n = ans.size();
	if (n == 1)return;
	for (int i = 0; i < n;) {
		if (ans[i] == i + 1)i++;
		else swap(ans[i], ans[ans[i] - 1]);
	}
}
int main()
{
	int a[] = { 1,5,3,2,7,6,4,9,10,8 };
	vector<int>ans(a, a + (sizeof(a) / sizeof(a[0])));
	sortArray(ans);
	for (auto x : ans) {
		cout << x << " ";
	}
	cout << endl;
	return 0;
}